package org.graduates.webapp.listen;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.projects.graduates.shiro.GradRealm;

public class IniShiroListener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		Realm gradRealm = new GradRealm();
		SecurityManager securityManager = new DefaultWebSecurityManager(gradRealm);
		SecurityUtils.setSecurityManager(securityManager);

	}

}
